compile:
	gcc -o nivel3 nivel3.c
	gcc -o nivel2 nivel2.c
	gcc -o nivel1 nivel1.c
	gcc -o nivel0 nivel0.c

run:
	rm -rf saidas/
	mkdir saidas

	ssh node2 './Projeto1/nivel3 node1 node3 node4 node5 node6 node7 node8 node9 > node2.txt &' &

	ssh node18 './Projeto1/nivel2 node2 > node18.txt &' &
	ssh node17 './Projeto1/nivel2 node2 > node17.txt &' &
	
	ssh node15 './Projeto1/nivel1 node18 > node15.txt &' &
	ssh node12 './Projeto1/nivel1 node18 > node12.txt &' &
	ssh node11 './Projeto1/nivel1 node17 > node11.txt &' &
	ssh node10 './Projeto1/nivel1 node17 > node10.txt &' &

	sleep 10
	
	ssh node9 './Projeto1/nivel0 node15 > node9.txt &' &
	ssh node8 './Projeto1/nivel0 node15 > node8.txt &' &
	ssh node7 './Projeto1/nivel0 node12 > node7.txt &' &
	ssh node6 './Projeto1/nivel0 node12 > node6.txt &' &
	ssh node5 './Projeto1/nivel0 node11 > node5.txt &' &
	ssh node4 './Projeto1/nivel0 node11 > node4.txt &' &
#	ssh node3 './Projeto1/nivel0 node10 > node3.txt &' &
#	ssh node1 './Projeto1/nivel0 node10 > node1.txt &' &

test:

	ssh -f node2 './testout testing > ./test.txt &' exit
